package org.ipower.examsystem.service.impl;

import java.util.List;
import org.ipower.examsystem.dao.InformationDao;
import org.ipower.examsystem.domain.Information;
import org.ipower.examsystem.service.InformationService;
import org.ipower.platform.domain.Pager;
import org.ipower.platform.domain.QueryCondition;
/**
 * 考试资讯管理服务实现类。
 * @author jeasonyoung
 */
public class InformationServiceImpl implements InformationService{
    private static final long serialVersionUID = 1L;
    private InformationDao dao = null;
  
    @Override
    public void setInformationDao(InformationDao dao) {
        this.dao = dao;
    }
        
    @Override
    public Pager<Information> findAll(String ascProperty, boolean isAsc, int start, int limit, List<QueryCondition> entites) {
        return this.dao.findAll(ascProperty, isAsc, start, limit, entites);
    }
  
    @Override
    public void saveOrUpdate(Information data) {
        if(data != null && data.getInfoID() != null && !data.getInfoID().isEmpty()){
             if(this.dao.load(data.getInfoID()) == null){
                 this.dao.save(data);
             }else{
                 this.dao.update(data);
             }
        }
    }

    @Override
    public void delete(String infoID) {
        if(infoID != null && !infoID.isEmpty()){
            this.dao.delete(infoID);
        }
    }
}